<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}


$listpurchase =$_SESSION['listpurchase'];

	$id=$_GET['id'];

#echo $_GET['action'];
if (isset($_GET['action'])){


	if($_GET['action']=='chQuantity'){
		$id=$_GET['id'];
		$listpurchase =$_SESSION['listpurchase'];
		for($i=0;$i<count($listpurchase);$i++){
			if ($i==($id-1)){
				$listpurchase[$i][3]=$_GET['value'];
				$listpurchase[$i][6]=sprintf("%01.0f",$listpurchase[$i][3]*$listpurchase[$i][5]);
			}
		}
		
	}
	
	
}
?>

	
				<?php 
				$i=1;
			
				foreach ($listpurchase as $purchase){?>
					<?php if($i==$id){?>
					<input type="text" name="totalamount[]" style="height: 24px; width: 96%; border: 1px solid #c4c0c9" readonly="readonly" value="<?=number_format($purchase[6])?>" />

					<?php }?>
				
				<?php 
				
				$i=$i+1;
				}?>
		
	
	
<?php $_SESSION['listpurchase']=$listpurchase;?>
